<div [dMovable]="true" [handle]="header" [moveEl]="parent">
  <div class="modal-header" #header>
    <d-row [dGutter]="[12, 12]">
      <d-col [dSpan]="22">
        {{ 'app.common.operate.new.title' | translate: data.title }}
      </d-col>
      <d-col [dSpan]="2" style="text-align: right">
        <d-button
          icon="icon-close"
          bsStyle="text-dark"
          title="{{ 'app.common.operate.close.label' | translate }}"
          (btnClick)="data.onClose()"
        ></d-button>
      </d-col>
    </d-row>
  </div>
  <form dForm ngForm [layout]="formLayout" [dValidateRules]="formConfig.rule" #form="dValidateRules"
        (dSubmit)="submitForm($event)">
    <div class="modal-body" style="padding: 0px 48px 0px 48px">
      <d-form-item>
        <d-form-label [required]="true">{{ 'job.job-config.name' | translate }}</d-form-label>
        <d-form-control>
          <input dTextInput name="name" [(ngModel)]="formData.name" [dValidateRules]="formConfig.nameRules" />
        </d-form-control>
      </d-form-item>
      <d-form-item>
        <d-form-label [required]="true">{{ 'job.job-config.type' | translate }}</d-form-label>
        <d-form-control>
          <d-select name="type"
                    [allowClear]="true"
                    [filterKey]="'label'"
                    [extraConfig]="{ selectedItemWithTemplate: { enable: true } }"
                    [options]="flinkJobTypeList"
                    [dValidateRules]="formConfig.typeRules"
                    size="sm"
                    [(ngModel)]="formData.type"></d-select>
        </d-form-control>
      </d-form-item>
      <d-form-item>
        <d-form-label [required]="true">{{ 'flink.cluster-config.name_' | translate }}</d-form-label>
        <d-form-control>
          <d-select name="flinkClusterConfig"
                    [allowClear]="true"
                    [enableLazyLoad]="true"
                    [filterKey]="'name'"
                    [extraConfig]="{ selectedItemWithTemplate: { enable: true } }"
                    [options]="flinkClusterConfigList"
                    size="sm"
                    (loadMore)="onFlinkClusterConfigLoadMore($event)"
                    [(ngModel)]="formData.flinkClusterConfig"></d-select>
        </d-form-control>
      </d-form-item>
      <d-form-item>
        <d-form-label>{{ 'job.remark' | translate }}</d-form-label>
        <d-form-control>
          <input dTextInput name="remark" [(ngModel)]="formData.remark" [dValidateRules]="formConfig.remarkRules"/>
        </d-form-control>
      </d-form-item>
    </div>
    <div class="modal-footer" style="text-align: right; padding-right: 42px">
      <d-form-operation>
        <d-button style="margin-right: 4px" bsStyle="common" (btnClick)="data.onClose($event)">
          {{ 'app.common.operate.cancel.label' | translate }}
        </d-button>
        <d-button bsStyle="primary" dFormSubmit>{{ 'app.common.operate.confirm.label' | translate }}</d-button>
      </d-form-operation>
    </div>
  </form>
</div>
